# Jpmobile::ViewSelector を vendor/plugins/*/app/views/ 以下にも適用。
# jpmobile/lib/jpmobile/rails.rb を参考に記述。
module Jpmobile
  module ViewSelector
    def self.included(base)
      base.class_eval do
        before_filter :register_mobile

        self._view_paths = self._view_paths.dup
        self.view_paths.unshift(Jpmobile::Resolver.new(File.join(Rails.root, "app/views")))
        Dir[File.join(Rails.root, "vendor/plugins/*/app/views/")].each do |file|
          self.view_paths.unshift(Jpmobile::Resolver.new(file))
        end
      end
    end
  end
end
